client-server syncing methodology [theoretical]
Posted
by
Kenneth Ballenegger
on Stack Overflow
See other posts from Stack Overflow
or by Kenneth Ballenegger
Published on 2010-12-26T21:06:17Z
Indexed on
2010/12/26
21:54 UTC
Read the original article
Hit count: 378
I'm in the progress of building an web-app that syncs with an iOS client. I'm currently tackling trying to figure out how to go about about syncing. I've come up with following two directions:
I've got a fairly simple server web-app with a list of items. They are ordered by date modified and as such syncing the order does not matter.
One direction I'm considering is to let the client deal with syncing. I've already got an API that lets the client get the data, as well as do certain actions on it, such as update, add or remove single items. I was considering: 1) on each sync asking the server for all items modified since the last successful sync and updating the local records based on what's returned by the server, and 2) building a persistent queue of create / remove / update requests on the client, and keeping them until confirmation by the server.
The risk with this approach is that I'm basically asking each side to send changes to the other side, hoping it works smoothly, but risking a diversion at some point. This would probably be more bandwidth-efficient, though.
The other direction I was considering was a more traditional model. I would have a "sync" process in which the client would send its whole list to the server (or a subset since last modified sync), the server would update the data on the server (by fixing conflicts by keeping the last modified item, and keeping deleted items with a deleted = 1 field), and the server would return an updated list of items (since last successful sync) which the client would then replace its data with.
Thoughts?
© Stack Overflow or respective owner